﻿@page "{name}/{handler?}"
@model AlbumsModel

@{
    ViewData["Title"] = Model.Album.Name;
    ViewData["Description"] = $"The photo album \"{Model.Album.Name}\" containing {Model.Album.Photos.Count} photos";
    ViewData["Image"] = Request.Scheme + "://" + Request.Host + Model.Album.CoverPhoto?.GetThumbnailLink((int)ImageType.Full, out int h);
}

<div id="admin" if-authorized>
    <form method="post" enctype="multipart/form-data">
        <input type="file" id="files" aria-label="Upload photo" name="files" required multiple accept="image/*" />
        <input type="submit" asp-page-handler="upload" data-progress="Uploading..." id="btnfiles" value="上传照片" />
    </form>

    <form method="post" class="delete">
        <input type="submit" asp-page-handler="delete" id="deletealbum" aria-label="Delete album..." title="删除相册..." value="X" />
    </form>
</div>


<div class="title" itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement">
    <paging model="@Model.Album" />
    <h2 itemscope itemtype="http://schema.org/Thing" itemprop="item">
        <span itemprop="name">@Model.Album.Name</span>
    </h2>
    <meta itemprop="position" content="2" />
</div>
<div class="pic photolist">
    @{
        foreach (Photo photo in Model.Album.Photos)
        {
            <a href="@photo.Link" data-text="@photo.DisplayName">
                <img photo="@photo" Type="Thumbnail" />
            </a>
        }
    }
</div>


@section scripts {
    <script if-authorized src="/js/admin.js" async></script>
   
}

@section head {
    <link if-authorized rel="stylesheet" href="/css/admin.scss" />
    @if (Model.Album.Next != null)
    {
        <link rel="next" href="@Model.Album.Next.Link" />
        <link rel="prefetch" href="@Model.Album.Next.Link" />
    }

    @if (Model.Album.Previous != null)
    {
        <link rel="prev" href="@Model.Album.Previous.Link" />
    }
}